<?php


/*
* Copyright (c) 2008-2016 vip.com, All Rights Reserved.
*
* Powered by com.vip.osp.osp-idlc-2.5.11.
*
*/

namespace com\vip\vipcard;

class QueryUserAccountInfoResp {
	
	static $_TSPEC;
	public $totalMoney = null;
	public $vipcard = null;
	public $giftMoney = null;
	public $limitCardUseNumFlag = null;
	public $limitUseNumMoney = null;
	public $favourableId = null;
	
	public function __construct($vals=null){
		
		if (!isset(self::$_TSPEC)){
			
			self::$_TSPEC = array(
			1 => array(
			'var' => 'totalMoney'
			),
			2 => array(
			'var' => 'vipcard'
			),
			3 => array(
			'var' => 'giftMoney'
			),
			4 => array(
			'var' => 'limitCardUseNumFlag'
			),
			5 => array(
			'var' => 'limitUseNumMoney'
			),
			6 => array(
			'var' => 'favourableId'
			),
			
			);
			
		}
		
		if (is_array($vals)){
			
			
			if (isset($vals['totalMoney'])){
				
				$this->totalMoney = $vals['totalMoney'];
			}
			
			
			if (isset($vals['vipcard'])){
				
				$this->vipcard = $vals['vipcard'];
			}
			
			
			if (isset($vals['giftMoney'])){
				
				$this->giftMoney = $vals['giftMoney'];
			}
			
			
			if (isset($vals['limitCardUseNumFlag'])){
				
				$this->limitCardUseNumFlag = $vals['limitCardUseNumFlag'];
			}
			
			
			if (isset($vals['limitUseNumMoney'])){
				
				$this->limitUseNumMoney = $vals['limitUseNumMoney'];
			}
			
			
			if (isset($vals['favourableId'])){
				
				$this->favourableId = $vals['favourableId'];
			}
			
			
		}
		
	}
	
	
	public function getName(){
		
		return 'QueryUserAccountInfoResp';
	}
	
	public function read($input){
		
		$input->readStructBegin();
		while(true){
			
			$schemeField = $input->readFieldBegin();
			if ($schemeField == null) break;
			$needSkip = true;
			
			
			if ("totalMoney" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->totalMoney);
				
			}
			
			
			
			
			if ("vipcard" == $schemeField){
				
				$needSkip = false;
				
				$this->vipcard = new \com\vip\vipcard\SubAccountInfo();
				$this->vipcard->read($input);
				
			}
			
			
			
			
			if ("giftMoney" == $schemeField){
				
				$needSkip = false;
				
				$this->giftMoney = new \com\vip\vipcard\SubAccountInfo();
				$this->giftMoney->read($input);
				
			}
			
			
			
			
			if ("limitCardUseNumFlag" == $schemeField){
				
				$needSkip = false;
				$input->readBool($this->limitCardUseNumFlag);
				
			}
			
			
			
			
			if ("limitUseNumMoney" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->limitUseNumMoney);
				
			}
			
			
			
			
			if ("favourableId" == $schemeField){
				
				$needSkip = false;
				$input->readString($this->favourableId);
				
			}
			
			
			
			if($needSkip){
				
				\Osp\Protocol\ProtocolUtil::skip($input);
			}
			
			$input->readFieldEnd();
		}
		
		$input->readStructEnd();
		
		
		
	}
	
	public function write($output){
		
		$xfer = 0;
		$xfer += $output->writeStructBegin();
		
		$xfer += $output->writeFieldBegin('totalMoney');
		$xfer += $output->writeString($this->totalMoney);
		
		$xfer += $output->writeFieldEnd();
		
		if($this->vipcard !== null) {
			
			$xfer += $output->writeFieldBegin('vipcard');
			
			if (!is_object($this->vipcard)) {
				
				throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
			}
			
			$xfer += $this->vipcard->write($output);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->giftMoney !== null) {
			
			$xfer += $output->writeFieldBegin('giftMoney');
			
			if (!is_object($this->giftMoney)) {
				
				throw new \Osp\Exception\OspException('Bad type in structure.', \Osp\Exception\OspException::INVALID_DATA);
			}
			
			$xfer += $this->giftMoney->write($output);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->limitCardUseNumFlag !== null) {
			
			$xfer += $output->writeFieldBegin('limitCardUseNumFlag');
			$xfer += $output->writeBool($this->limitCardUseNumFlag);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->limitUseNumMoney !== null) {
			
			$xfer += $output->writeFieldBegin('limitUseNumMoney');
			$xfer += $output->writeString($this->limitUseNumMoney);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		if($this->favourableId !== null) {
			
			$xfer += $output->writeFieldBegin('favourableId');
			$xfer += $output->writeString($this->favourableId);
			
			$xfer += $output->writeFieldEnd();
		}
		
		
		$xfer += $output->writeFieldStop();
		$xfer += $output->writeStructEnd();
		return $xfer;
	}
	
}

?>